package base_code2.pool;

import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Demo {
    public static void main(String[] args) {
        //创建线程池
        ExecutorService pool1 = Executors.newCachedThreadPool();
        ExecutorService pool2 = Executors.newFixedThreadPool(3);
        //创建线程并提交
        pool1.submit(new Myrun());
        pool1.submit(new Myrun());
        pool1.submit(new Myrun());
        pool1.submit(new Myrun());
        pool2.submit(new Myrun());
        //销毁
    }
}
